package game;


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;

public class SaveGameLevelToDisk 
	implements ActionListener
{
	@Override
	public void actionPerformed(ActionEvent e)
	{
		File file;
		try
		{
			file = new File("c:\\stuff\\temp\\game.txt");
			JAXBContext jaxbContext = JAXBContext.newInstance(GameLevelImpl.class);
			Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
			// output pretty printed
			jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
	 
			jaxbMarshaller.marshal(Game.gameLevel(), file);
			jaxbMarshaller.marshal(Game.gameLevel(), System.out);
		}
		catch(Exception exc)
		{
			System.out.println(exc);
		}

	}
}
